package java_class_work.week05;

import java.io.File;
import java.io.IOException;

public class IOstreamDemo01 {
    public static void main(String[] args) {
        // 创建文件
        String path = "E:"+ File.separator+"Class"+ File.separator+"Java面向对象程序设计"+
                File.separator+"Java_20220624"+ File.separator+"src"+
                File.separator+"java_class_work"+ File.separator+"iotest";
        File file = new File(path,"Test1.java");
        if (!file.exists()) {
            try {
                boolean bool = file.createNewFile();
                if (bool) {
                    System.out.println("create success!");
                }else{
                    System.out.println("create defeat!");
                }
            } catch (IOException e) {
                e.printStackTrace();
                System.out.println("文件创建异常");
            }
        }else System.out.println("文件已存在");
    }
}
